//
//  TeaAndIcreAndLifeTableViewCell.m
//  Products_B
//
//  Created by lanou on 16/5/28.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "TeaAndIcreAndLifeTableViewCell.h"

@implementation TeaAndIcreAndLifeTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 110, kWidth/ 3 - 10, 20)];
        self.imageLabel.textColor = [UIColor redColor];
        self.imageLabel.font = [UIFont systemFontOfSize:13];
       
        self.countLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWidth/ 3/ 2 - 30, 130, 60, 20)];
        self.countLabel.textColor = [UIColor magentaColor];
        self.countLabel.font = [UIFont systemFontOfSize:13];
        self.bigImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,kWidth / 3 , 150)];
        self.bigImageView.contentMode = UIViewContentModeScaleAspectFill ;
        self.bigImageView.clipsToBounds = YES;
         [_bigImageView setContentScaleFactor:[[UIScreen mainScreen] scale]];
        
        
        self.bigImageView.backgroundColor = [UIColor magentaColor];
        self.imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth/3, 0, kWidth/3, 75)];
        self.imageView2 = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth/3*2, 0, kWidth/3, 75)];
        self.imageView3 = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth/3, 75, kWidth, 75)];
        self.imageView4 = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth/3*2, 75, kWidth/3, 75)];
        self.imageView1.contentMode = UIViewContentModeScaleAspectFill ;
        self.imageView1.clipsToBounds = YES;
        [self.imageView1 setContentScaleFactor:[[UIScreen mainScreen] scale]];
        
        self.imageView2.contentMode = UIViewContentModeScaleAspectFill ;
        self.imageView2.clipsToBounds = YES;
        [_imageView2 setContentScaleFactor:[[UIScreen mainScreen] scale]];
//
        self.imageView3.contentMode = UIViewContentModeScaleAspectFill ;
        self.imageView3.clipsToBounds = YES;
        [_imageView3 setContentScaleFactor:[[UIScreen mainScreen] scale]];
//
        self.imageView4.contentMode = UIViewContentModeScaleAspectFill ;
        self.imageView4.clipsToBounds = YES;
        [_imageView4 setContentScaleFactor:[[UIScreen mainScreen] scale]];
        
        self.contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 150, kWidth - 60, 30)];
        self.contentLabel.textColor = [UIColor grayColor];
          
//        self.contentLabel.backgroundColor = [UIColor magentaColor];
        [self.bigImageView addSubview:_imageLabel];
        [self.bigImageView addSubview:_countLabel];
        [self.contentView addSubview:_bigImageView];
        [self.contentView addSubview:_imageView1];
        [self.contentView addSubview:_imageView2];
        [self.contentView addSubview:_imageView3];
        [self.contentView addSubview:_imageView4];
        [self.contentView addSubview:_contentLabel];
    }
    return self;
}
- (void)cellConfigureWithArray:(NSArray *)array desc:(NSString *)desc{
    NSLog(@"%@",array);
    if (array.count == 0) {
        return;
    }
    [self.bigImageView sd_setImageWithURL:[NSURL URLWithString:array[0][0]] placeholderImage:nil completed:nil];
    self.imageLabel.text = array[0][1];
    self.countLabel.text = array[0][2];
    [_imageView1 sd_setImageWithURL:[NSURL URLWithString:array[1][0]] placeholderImage:nil completed:nil];
    [_imageView2 sd_setImageWithURL:[NSURL URLWithString:array[2][0]] placeholderImage:nil completed:nil];
    [_imageView3 sd_setImageWithURL:[NSURL URLWithString:array[3][0]] placeholderImage:nil completed:nil];
    [_imageView4 sd_setImageWithURL:[NSURL URLWithString:array[4][0]] placeholderImage:nil completed:nil];
    self.contentLabel.text = desc;
}
@end
